package org.example.prototype;

/**
 * 原型模式是指某个接口实现cloneable类使其拥有object.clone的方法,
 * 实现这个接口的实现类可以调用super.clone方法来克隆一个自身的对象
 */
public class PrototypeTest {
    public static void main(String[] args) throws CloneNotSupportedException {
        IPrototype prototype = new MediaPrototype();
        IPrototype clone = prototype.clone();
        System.out.println(123);
        PrototypeFactory prototypeFactory = new PrototypeFactory();
        IPrototype media = prototypeFactory.getPrototypeClone("media");
        media.getName();
        IPrototype ebook = prototypeFactory.getPrototypeClone("ebook");
        ebook.getName();
    }
}
